package api

import (
	"ecommerce-customer-support-chat/api/handler"
	"ecommerce-customer-support-chat/consts"
	"github.com/gin-gonic/gin"
	jwt "github.com/golangblogs/gojwt"
)

func Router(r *gin.Engine) {

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("/register", handler.Register)
			user.POST("/login", handler.Login)
		}

		chat := api.Group("/chat")
		{
			chat.Use(jwt.JWTAuth(consts.JWT_KEY))
			chat.GET("/ws", handler.Chat)

			chat.POST("/create", handler.Create)
			chat.POST("/addGroupUser", handler.AddGroupUser)
		}
	}

}
